﻿@{
    ViewBag.Title = "index";
}

<div class="row">
    <div class="col-md-2"></div>

    <div class="col-md-8">
        <div class="panel panel-default">
            <div class="panel-heading">管理员提取营业款</div>
            <div class="panel-body">
                <label>提款人：</label><label>彭涛</label>
                <div class="form-group">

                    <form action="TakeMoney/TakeMoney" role="form">
                        <div class="form-group">
                            <label for="TakeMoney">提款金额:</label>
                            <input type="text" class="form-control" id="TakeMoney" name="TakeMoney" placeholder="提款金额">
                        </div>
                        <span class="text-danger"></span><button type="submit" class="btn btn-default pull-right" >确定</button>
                    </form>
                </div>
            </div>
           
        </div>
    </div>
    <div class="col-md-2"></div>

</div>


<script type="text/javascript">

    $(function () {
        $('form').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                TakeMoney: {
                    message: '输入不能为空',
                    validators: {
                        notEmpty: {
                            message: '提款金额不能为空！'
                        },
                        numeric:{
                            message:'提款金额必须是数字'
                        }
                    }
                }


            }
        }).on('success.form.bv', function(e) {//点击提交之后
            // Prevent form submission
            e.preventDefault();

            // Get the form instance
            var $form = $(e.target);

            // Get the BootstrapValidator instance
            var bv = $form.data('bootstrapValidator');

            // Use Ajax to submit form data 提交至form标签中的action，result自定义
            $.post($form.attr('action'), $form.serialize(), function(result) {
                if (result == "ok")
                {
                    $("form span").html("提款成功！");
                }
            });
        });
    });
</script>

